class Solution
{
public:
    int minFlips(string target)
    {
        int step = target[0] == '1';
        int n = target.size();
        for (int i = 1; i < n; ++i)
        {
            if (target[i] != target[i - 1])
            {
                ++step;
            }
        }
        return step;
    }
};